package cn.com.surker.weight.dao;

import cn.com.surker.weight.entity.WeightOrder;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 过磅订单表 Mapper 接口
 * </p>
 *
 * @author admin
 * @since 2024-11-06
 */
public interface WeightOrderDao extends BaseMapper<WeightOrder> {

    /**
     * 根据车牌查询未完成订单
     * @param carNo
     * @return
     */
    List<WeightOrder> findByCarNoOrder(String carNo);

    /**
     * 根据车牌删除车牌订单
     * @param carNo
     * @param remark
     * @return
     */
    Integer updateOrderStatus(String carNo, String remark);

    /**
     * 根据orderid查询订单
     * @param code
     * @return
     */
    WeightOrder findByOrder(String code, String openid, String carNo, String phone);

    /**
     * 更新删除订单
     * @param weightOrder
     * @return
     */
    Integer updateOrder(WeightOrder weightOrder);

    /**
     * 分页查询单站原始过磅记录
     * @param page
     * @param queryWrapper
     * @param dbCode
     * @param <E>
     * @return
     */
    <E extends IPage<WeightOrder>> E findDbPage(E page, @Param(Constants.WRAPPER) Wrapper<WeightOrder> queryWrapper, String dbCode);

    List<WeightOrder> findDbPage(@Param(Constants.WRAPPER) Wrapper<WeightOrder> queryWrapper, String dbCode);
}
